package com.broada.apm.service;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;

import com.broada.apm.ajax.IndicatorResult;
import com.broada.apm.ajax.PerformanceResult;
import com.broada.apm.ajax.ResourceResult;
import com.wordnik.swagger.annotations.Api;
import com.wordnik.swagger.annotations.ApiOperation;
import com.wordnik.swagger.annotations.ApiParam;

@Path("apm/keytrades")
@Api(value="apm/keytrades" , description = "交易类型相关的APIs")
@Produces(MediaType.APPLICATION_JSON)
public interface KeyTradeService {
	@GET
	@ApiOperation(value = "appId下的关键交易列表")
	@Produces(MediaType.APPLICATION_JSON)
	public ResourceResult queryKeyTradeByPage(@ApiParam(value = "应用系统id", required = true) @QueryParam("appId") String appId);

	@GET
	@Path("/{tradeId}")
	@ApiOperation(value = "根据交易ID查询关键交易")
	@Produces(MediaType.APPLICATION_JSON)
	public ResourceResult queryKeyTradeByKey(@ApiParam(value = "交易类型id", required = true) @PathParam("tradeId") String tradeId);

	@GET
	@Path("/performances/subtotal")
	@ApiOperation(value = "appId下的所有关键交易当前一小时内的性能数据小计")
	@Produces(MediaType.APPLICATION_JSON)
	public PerformanceResult queryResourcePerformanceSubTotal(
			@ApiParam(value = "应用系统id", required = true) @QueryParam("appId") String appId,
			@ApiParam(value = "关键词", required = false) @QueryParam("keyWord") String keyWord, 
			@ApiParam(value = "查询开始时间", required = true) @QueryParam("startDate") long startDate,
			@ApiParam(value = "查询结束时间", required = true) @QueryParam("endDate") long endDate);
	
	@GET
	@Path("/indicators")
	@ApiOperation(value = "查询数据项")
	@Produces(MediaType.APPLICATION_JSON)
	public IndicatorResult queryIndicators(
			@ApiParam(value = "应用系统id", required = true) @QueryParam("appId") String appId, 
			@ApiParam(value = "交易类型id", required = true) @QueryParam("tradeId") String tradeId);
	
}
